package com.REPDPMSystem.Controller;
import com.REPDPMSystem.Service.MonitorService;
import com.REPDPMSystem.Utils.ScreenCaptureUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

@RestController
public class MonitorController {
    @Autowired
    MonitorService monitorService;
    @Autowired
    ScreenCaptureUtil screenCaptureUtil;

    @GetMapping("/GET/monitorZip")
    public void monitorZip(HttpServletResponse response,
                           @RequestParam(value = "staff_id") String staff_id,
                           @RequestParam(value = "startTime") long startTime,
                           @RequestParam(value = "endTime") long endTime) throws IOException {
        monitorService.downLoad(response,staff_id,startTime,endTime);

    }
    @PostMapping("/POST/captureScreen")
    public void captureScreen(@RequestParam(value = "staff_id")String staff_id){
        screenCaptureUtil.captureScreen(staff_id);
    }
}
